﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace Model
{
    [Serializable]
    public partial class Sys0a60
    {
		private string _sncode;
		private string _sname;
		private string _headsn;
		private string _upmode;
        private int? _maxlen;
		private string _nowvalue;
        private int? _nowno;
        private bool? _ispublic;
		private string _stype;
		private string _muser;
        private DateTime? _mdate;
		
        /// <summary>
        /// 编码
        /// </summary>
		public string Sncode
		{
			get { return _sncode;	 }
			set { _sncode=value;	}
		}
        /// <summary>
        /// 名称
        /// </summary>
		public string Sname
		{
			get { return _sname;	 }
			set { _sname=value;	}
		}
        /// <summary>
        /// 编码前缀
        /// </summary>
		public string Headsn
		{
			get { return _headsn;	 }
			set { _headsn=value;	}
		}
        /// <summary>
        /// 更新方式
        /// </summary>
		public string Upmode
		{
			get { return _upmode;	 }
			set { _upmode=value;	}
		}
        /// <summary>
        /// 编码长度
        /// </summary>
		public int? Maxlen
		{
			get { return _maxlen;	 }
			set { _maxlen=value;	}
		}
        /// <summary>
        /// 当前值
        /// </summary>
		public string Nowvalue
		{
			get { return _nowvalue;	 }
			set { _nowvalue=value;	}
		}
        /// <summary>
        /// 当前序号值
        /// </summary>
		public int? Nowno
		{
			get { return _nowno;	 }
			set { _nowno=value;	}
		}
        /// <summary>
        /// 是否公用
        /// </summary>
		public bool? Ispublic
		{
			get { return _ispublic;	 }
			set { _ispublic=value;	}
		}
        /// <summary>
        /// S/I, S 如果不够长度，会自动在前面补零
        /// </summary>
		public string Stype
		{
			get { return _stype;	 }
			set { _stype=value;	}
		}
        /// <summary>
        /// 维护者
        /// </summary>
		public string Muser
		{
			get { return _muser;	 }
			set { _muser=value;	}
		}
        /// <summary>
        /// 维护时间
        /// </summary>
		public DateTime? Mdate
		{
			get { return _mdate;	 }
			set { _mdate=value;	}
		}
		
		public static List<Sys0a60> GetSys0a60ListByDataTable(DataTable dt)
		{
			if(dt == null) return null;
		    List<Sys0a60> list = new List<Sys0a60>();
		   
			foreach(DataRow dr in dt.Rows)
            {
				Sys0a60 model = GetSys0a60ByDataRow(dr);
				if(null == model) continue;
				
				list.Add(model);
            }
           return list;
		}
		
		public static Sys0a60 GetSys0a60ByDataRow(DataRow dr)
		{
			Sys0a60 model = new Sys0a60(); //实例化Sys0a60
	
			DataColumnCollection dcc = dr.Table.Columns;

			if (dcc.Contains("sncode")&&!(dr["sncode"] is System.DBNull))  
				model.Sncode = ( string)dr["sncode"];
			if (dcc.Contains("sname")&&!(dr["sname"] is System.DBNull))  
				model.Sname = ( string)dr["sname"];
			if (dcc.Contains("headsn")&&!(dr["headsn"] is System.DBNull))  
				model.Headsn = ( string)dr["headsn"];
			if (dcc.Contains("upmode")&&!(dr["upmode"] is System.DBNull))  
				model.Upmode = ( string)dr["upmode"];
			if (dcc.Contains("maxlen")&&!(dr["maxlen"] is System.DBNull))  
				model.Maxlen = ( int)dr["maxlen"];
			if (dcc.Contains("nowvalue")&&!(dr["nowvalue"] is System.DBNull))  
				model.Nowvalue = ( string)dr["nowvalue"];
			if (dcc.Contains("nowno")&&!(dr["nowno"] is System.DBNull))  
				model.Nowno = ( int)dr["nowno"];
			if (dcc.Contains("ispublic")&&!(dr["ispublic"] is System.DBNull))  
				model.Ispublic = ( bool)dr["ispublic"];
			if (dcc.Contains("stype")&&!(dr["stype"] is System.DBNull))  
				model.Stype = ( string)dr["stype"];
			if (dcc.Contains("muser")&&!(dr["muser"] is System.DBNull))  
				model.Muser = ( string)dr["muser"];
			if (dcc.Contains("mdate")&&!(dr["mdate"] is System.DBNull))  
				model.Mdate = ( DateTime)dr["mdate"];
			
			return model;
		}
    }
}
